import { createStore } from 'vuex'

export default createStore({
  state: {

    //用户信息
    userinfo:{
      username:'',
      password:'',
      phone:'',
      userimg:'',
      role:'',
      name:'',
      status:''
    },
    //token
    token:'',
    //修改菜品时传递的id
    dishId:0,
    //修改套餐时传递的id
    taocanId:0
  },
  getters: {
  },
  mutations: {
    setUserinfo(state,user){
      state.userinfo.username = user.username;
      state.userinfo.password = user.password;
      state.userinfo.userimg = user.userImg;
      state.userinfo.role = user.role;
      state.userinfo.phone = user.phone
      state.userinfo.name = user.name
      state.userinfo.status = user.status
    },
    //清空用户数据
    delUserinfo(state){
      state.userinfo.username = ''
      state.userinfo.userimg='',
      state.userinfo.password = '',
      state.userinfo.role= ''
      state.userinfo.phone= ''
      state.userinfo.name = ''
      state.userinfo.status = ''
    }

  },
  actions: {
  },
  modules: {
  }
})
